with Website_Retrieval.Http_Get;

--
-- Tests for Website Retrieval package
--

package Test_Website_Retrieval is

   --
   -- run all tests
   --

   procedure Tests_Suite;


private

   --
   -- tests
   --

   --
   -- test download of URL contents into Bounded String
   --

   procedure Test_Into_String;

   --
   -- test download of URL contents into file system
   --

   procedure Test_Into_File;


   --
   -- types, constants shared by tests
   --

   --
   -- constants
   --

   SITE_IP  : constant String := "http://54.84.39.80";

   SITE_SSL : constant String := "https://musmlib.org/index.html";

   SITE     : constant String := "http://musmlib.org/sse/sse_archive/"

      & "661_software_architecture/project1/hatfield/index.html";

   SITE_CONTENTS_LENGTH : constant := 478;   -- html as String, length

   SITE_VALID_TXT : constant String := ".+<title>SSE 661 Project 1 Hatfield"

      & "</title>.+";

   MAX_DOWNLOAD   : constant := 5000;

   TEST_FILE_NAME : constant String := "web_content";

   EXPECTED_CONTENTS_FILE_NAME  : constant String := "test_website_download"

         & ".html";


   --
   -- generic types
   --

   -- like the Unbounded String instances, an Integer type is used to
   --    control size via generic

   package WebGet_Type is new Website_Retrieval( MAX_DOWNLOAD );

   -- access the parent class' useful constants, argument types

   use WebGet_Type;

   -- create instance of child class which implements desired functionality

   package WebGetHTTP_Type is new WebGet_Type.HTTP_Get( MAX_DOWNLOAD );

   -- get the interface type used essentially as a mediator

   WebGet_Obj : WebGetHTTP_Type.Website_Retrieval_Object;


   --
   -- bound strings
   --

   Host_Addr_Parm_SSL : Host_Address_Sub_Type;

   Host_Addr_Parm_IP  : Host_Address_Sub_Type;

   Host_Addr_Parm     : Host_Address_Sub_Type;

   File_Name_Parm     : File_Name_Sub_Type;

   -- used to satisfy argument list for website retrieval when downloading to
   --    file instead of String

   Empty_Output       : Output_String_Type.Bounded_String;

   -- URL contents: html, etc.

   Downloaded_Content : Output_String_Type.Bounded_String;


end Test_Website_Retrieval;